import request from '@/utils/request'
import { exportFileByUrl, GetParams } from "@/utils/common.js";

// 分销佣金分析
export function GetCommissionData(params) {
  return request({
    url: 'budms/distribution/commission',
    method: 'get',
    params
  })
}

export function GetCommissionDataDownloadUrl( params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distribution/commission${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}

export function GetCommissionDataDetailList(params) {
  return request({
    url: 'budms/distribution/commission/list',
    method: 'get',
    params
  })
}

export function GetCommissionDataDetailListDownloadUrl(params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distribution/commission/list${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
// 分销数据概览
// 分销数据概览-代申购业务
export function GetGenofpurchaseData(params) {
  return request({
    url: 'budms/distribution/genofpurchase',
    method: 'get',
    params
  })
}

export function GetGenofpurchaseDataDownloadUrl(params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distribution/genofpurchase${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}

export function GetGenofpurchaseDataDetailList(params) {
  return request({
    url: 'budms/distribution/genofpurchase/list',
    method: 'get',
    params
  })
}
export function GetGenofpurchaseDataDetailListDownloadUrl(params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distribution/genofpurchase/list${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
// 分销数据概览-代缴款业务
export function GetGenofpaymentData(params) {
  return request({
    url: 'budms/distribution/genofpayment',
    method: 'get',
    params
  })
}
export function GetGenofpaymentDataDownloadUrl(params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distribution/genofpayment${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
export function GetGenofpaymentDataDetailList(params) {
  return request({
    url: 'budms/distribution/genofpayment/list',
    method: 'get',
    params
  })
}
export function GetGenofpaymentDataDetailListDownloadUrl(params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distribution/genofpayment/list${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
// 账户持仓监控
export function GetPositionData(params) {
  return request({
    url: 'budms/distribution/position',
    method: 'get',
    params
  })
}
export function GetPositionDataDownloadUrl(params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distribution/position${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
export function GetPositionDataDetailList(params) {
  return request({
    url: 'budms/distribution/position/list',
    method: 'get',
    params
  })
}
export function GetPositionDataDetailListDownloadUrl(params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distribution/position/list${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
// 账户持仓利润
export function GetPositionprofitData(params) {
  return request({
    url: 'budms/distribution/positionprofit',
    method: 'get',
    params
  })
}
export function GetPositionprofitDataDownloadUrl(params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distribution/positionprofit${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
export function GetPositionprofitDetailList(params) {
  return request({
    url: 'budms/distribution/positionprofit/list',
    method: 'get',
    params
  })
}
export function GetPositionprofitDetailListDownloadUrl(params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distribution/positionprofit/list${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}

